package com.crazy.jiakoulachang.exception;

import lombok.Data;

/**
 * @author: 卢辉宇
 * @date: 2022/12/13 12:17
 * @description: 自定义统一异常
 */
@Data
public class MallException extends RuntimeException{
    private final Integer CODE;
    private final String MSG;

    /*传统的构造方法*/
    public MallException(Integer CODE, String MSG) {
        this.CODE = CODE;
        this.MSG = MSG;
    }

    /*传入枚举的构造方法*/
    public MallException(ExceptionEnum ex){
        this(ex.getStatus(), ex.getMsg());
    }

    /*传入枚举获取code,和描述的构造方法,*/
    public MallException(ExceptionEnum ex,String MSG){
        this(ex.getStatus(), MSG);
    }
}
